from django.db import models
from django.contrib.auth.models import User

GENDER_CHOICES = (
    ('', 'Decline'),
    ('M', 'Male'),
    ('F', 'Female'),
)

class userprofile(models.Model):
    user = models.ForeignKey(User, unique=True)
    #User accessable/settable attributes only
    image = models.ImageField(upload_to="profile_images/", default='')
    birthdate = models.DateField(blank=True, null=True)
    gender = models.CharField(blank=True, max_length=1, choices=GENDER_CHOICES)
    address = models.TextField(blank=True, default='')
    phone = models.CharField(blank=True, default='', max_length = 20)
    website = models.CharField(blank=True, default='', max_length = 100)
    about = models.TextField(blank=True, default='')
    public = models.BooleanField(default=False)
    gym_staff = models.BooleanField(default=False)
    #Staff accessable/settable attribtutes only
    id_card = models.CharField(blank=True, max_length=50, default='')
    comments = models.TextField(blank = True, default='')

User.profile = property(lambda u: userprofile.objects.get_or_create(user=u)[0])
